! function (e) {
    var t = {};

    function r(n) {
        if (t[n]) return t[n].exports;
        var o = t[n] = {
            i: n,
            l: !1,
            exports: {}
        };
        return e[n].call(o.exports, o, o.exports, r), o.l = !0, o.exports
    }
    r.m = e, r.c = t, r.d = function (e, t, n) {
        r.o(e, t) || Object.defineProperty(e, t, {
            enumerable: !0,
            get: n
        })
    }, r.r = function (e) {
        "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
            value: "Module"
        }), Object.defineProperty(e, "__esModule", {
            value: !0
        })
    }, r.t = function (e, t) {
        if (1 & t && (e = r(e)), 8 & t) return e;
        if (4 & t && "object" == typeof e && e && e.__esModule) return e;
        var n = Object.create(null);
        if (r.r(n), Object.defineProperty(n, "default", {
                enumerable: !0,
                value: e
            }), 2 & t && "string" != typeof e)
            for (var o in e) r.d(n, o, function (t) {
                return e[t]
            }.bind(null, o));
        return n
    }, r.n = function (e) {
        var t = e && e.__esModule ? function () {
            return e.default
        } : function () {
            return e
        };
        return r.d(t, "a", t), t
    }, r.o = function (e, t) {
        return Object.prototype.hasOwnProperty.call(e, t)
    }, r.p = ".", r(r.s = 13)
}([function (e, t) {
    e.exports = function (e) {
        return e && e.__esModule ? e : {
            default: e
        }
    }
}, function (e, t, r) {
    "use strict";
    var n = r(0)(r(0));
    Object.defineProperty(t, "__esModule", {
        value: !0
    }), t.decipher = t.cipher = t.fetch_retry = t.fetchWithTimeout = void 0;
    var o = r(2),
        a = (0, n.default)(o);

    function i(e, t) {
        var r = Object.keys(e);
        if (Object.getOwnPropertySymbols) {
            var n = Object.getOwnPropertySymbols(e);
            t && (n = n.filter((function (t) {
                return Object.getOwnPropertyDescriptor(e, t).enumerable
            }))), r.push.apply(r, n)
        }
        return r
    }

    function s(e) {
        for (var t = 1; t < arguments.length; t++) {
            var r = null != arguments[t] ? arguments[t] : {};
            t % 2 ? i(Object(r), !0).forEach((function (t) {
                (0, a.default)(e, t, r[t])
            })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : i(Object(r)).forEach((function (t) {
                Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t))
            }))
        }
        return e
    }
    var u = t.fetchWithTimeout = function (e) {
        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
            r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 5e3,
            n = new AbortController,
            o = s({}, t, {
                signal: n.signal
            });
        setTimeout((function () {
            n.abort()
        }), r);
        return fetch(e, o).then((function (e) {
            if (!e.ok) throw new Error("".concat(e.status, ": ").concat(e.statusText));
            return e
        })).catch((function (e) {
            if ("AbortError" === e.name) throw new Error("Response timed out");
            throw new Error(e.message)
        }))
    };
    t.fetch_retry = function e(t, r, n) {
        var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1;
        return u(t, r, n).catch((function (a) {
            if (1 === o) throw a;
            return e(t, r, n, o - 1)
        }))
    }, t.cipher = function (e) {
        var t = function (e) {
                return e.split("").map((function (e) {
                    return e.charCodeAt(0)
                }))
            },
            r = function (e) {
                return ("0" + Number(e).toString(16)).substr(-2)
            },
            n = function (r) {
                return t(e).reduce((function (e, t) {
                    return e ^ t
                }), r)
            };
        return function (e) {
            return e.split("").map(t).map(n).map(r).join("")
        }
    }, t.decipher = function (e) {
        var t = function (t) {
            return (r = e, r.split("").map((function (e) {
                return e.charCodeAt(0)
            }))).reduce((function (e, t) {
                return e ^ t
            }), t);
            var r
        };
        return function (e) {
            return e.match(/.{1,2}/g).map((function (e) {
                return parseInt(e, 16)
            })).map(t).map((function (e) {
                return String.fromCharCode(e)
            })).join("")
        }
    }
}, function (e, t) {
    e.exports = function (e, t, r) {
        return t in e ? Object.defineProperty(e, t, {
            value: r,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : e[t] = r, e
    }
}, function (e, t, r) {
    "use strict";
    Object.defineProperty(t, "__esModule", {
        value: !0
    }), t.DISABLE_DOWNLOADING_FROM_YOUTUBE_REGEXP = t.supportedLanguages = t.t = t.PRE_DEF_EXTS = t.YTDLPAGE = t.HOMEPAGE = t.ISEDGE = t.PROENV = void 0, t.doInit = function () {
        if (void 0 === localStorage[i] || "" == localStorage[i]) {
            var e = new Array({
                ext: "flv",
                size: 10
            }, {
                ext: "hlv",
                size: 10
            }, {
                ext: "f4v",
                size: 10
            }, {
                ext: "mp4",
                size: 10
            }, {
                ext: "mp3",
                size: 10
            }, {
                ext: "wma",
                size: 10
            }, {
                ext: "wav",
                size: 10
            }, {
                ext: "m4a",
                size: 10
            }, {
                ext: "webm",
                size: 10
            }, {
                ext: "ogg",
                size: 10
            }, {
                ext: "ogv",
                size: 10
            }, {
                ext: "acc",
                size: 10
            }, {
                ext: "mov",
                size: 10
            }, {
                ext: "mkv",
                size: 10
            }, {
                ext: "m3u8",
                size: 0
            }, {
                ext: "ts",
                size: 1e11
            });
            localStorage[i] = JSON.stringify(e)
        }
        if (void 0 === localStorage.Type) {
            var t = new Array({
                Type: "video/*",
                size: 2048
            }, {
                Type: "audio/*",
                size: 10
            });
            localStorage.Type = JSON.stringify(t)
        }
        if (void 0 === localStorage.BlockedDomains) {
            var r = new Array;
            localStorage.BlockedDomains = JSON.stringify(r)
        }
        void 0 === localStorage.repeat && (localStorage.repeat = !1);
        void 0 === localStorage.repeatReg && (localStorage.repeatReg = "\\?[\\S]+");
        void 0 === localStorage.Debug && (localStorage.Debug = !1);
        void 0 === localStorage.TitleName && (localStorage.TitleName = !1);
        void 0 === localStorage.popListCount && (localStorage.popListCount = 30);
        void 0 === localStorage.showCountOnIcon && (localStorage.showCountOnIcon = !0)
    }, t.tr = function (e) {
        $("#" + e).html(s(e))
    }, t.getLanguage = c, t.getExtManifest = function () {
        return o.runtime.getManifest()
    }, t.isActivePro = d, t.getLoaderUrl = function () {
        var e, t, r = c(),
            n = "://www.cnbbx.com/";
        e = "other" != r ? "hls.html" : "ohls.html";
        d() && (n = "://www.cnbbx.com/", e = "hls.vhtml", "other" == r && (e = "ohls.vhtml"));
        t = a ? n + (u.includes(r) ? r + "/" : "") + e : "://127.0.0.1/" + e;
        return t
    }, t.getDLMUrl = function () {
        var e, t, r = c(),
            n = "://www.cnbbx.com/";
        e = "other" != r ? "dlm.html" : "odlm.html";
        d() && (n = "://www.cnbbx.com/", e = "dlm.vhtml", "other" == r && (e = "odlm.vhtml"));
        t = a ? n + "dlm/" + (u.includes(r) ? r + "/" : "") + e : "://127.0.0.1/dlm/" + e;
        return t
    };
    var n = r(1),
        o = navigator.userAgent.includes("Chrome") ? chrome : browser,
        a = t.PROENV = !0;
    t.ISEDGE = !1, t.HOMEPAGE = void 0, t.YTDLPAGE = void 0;
    a ? (t.HOMEPAGE = "https://www.cnbbx.com", t.YTDLPAGE = "https://www.cnbbx.com/yt/") : (console.log("dev env"), t.HOMEPAGE = "http://127.0.0.1", t.YTDLPAGE = "http://127.0.0.1");
    var i = t.PRE_DEF_EXTS = "Ext04";
    o.browserAction.setIcon({
        path: {
            16: "assets/icons/16x16_gray.png",
            32: "assets/icons/32x32_gray.png",
            48: "assets/icons/48x48_gray.png",
            64: "assets/icons/64x64_gray.png",
            128: "assets/icons/128x128_gray.png"
        }
    });
    var s = t.t = o.i18n.getMessage;
    var u = t.supportedLanguages = ["zh_tw", "zh_cn"];

    function c() {
        var e = o.i18n.getUILanguage();
        return e.match(/zh-CN/) ? "zh_cn" : e.match(/zh-TW/) ? "zh_tw" : e.startsWith("zh") ? "zh_cn" : e.startsWith("en") ? e.substr(0, 2) : "other"
    }
    if (o.runtime.onInstalled.addListener((function (e) {
            var t = c(),
                r = "https://www.cnbbx.com/" + (u.includes(t) ? t + "/" : "") + "installed.html";
            localStorage.getItem("installed") || o.tabs.create({
                url: r
            }, (function (e) {
                console.log("Hi, wellcome:)"), localStorage.setItem("installed", "t")
            }))
        })), o.runtime.setUninstallURL) {
        var l = c(),
            f = "https://www.cnbbx.com/" + (u.includes(l) ? l + "/" : "") + "uninstalled.html";
        o.runtime.setUninstallURL(f)
    }
    t.DISABLE_DOWNLOADING_FROM_YOUTUBE_REGEXP = /^https?:\/\/www\.youtube\.com\//;

    function d() {
        if (localStorage.getItem("pui") && "active" == (0, n.decipher)("CocoCut pro user")(localStorage.getItem("pui")).split("|")[3]) return !0;
        return !1
    }
}, function (e, t, r) {
    e.exports = r(7)
}, function (e, t) {
    function r(e, t, r, n, o, a, i) {
        try {
            var s = e[a](i),
                u = s.value
        } catch (e) {
            return void r(e)
        }
        s.done ? t(u) : Promise.resolve(u).then(n, o)
    }
    e.exports = function (e) {
        return function () {
            var t = this,
                n = arguments;
            return new Promise((function (o, a) {
                var i = e.apply(t, n);

                function s(e) {
                    r(i, o, a, s, u, "next", e)
                }

                function u(e) {
                    r(i, o, a, s, u, "throw", e)
                }
                s(void 0)
            }))
        }
    }
}, function (e, t, r) {
    "use strict";
    var n = r(0)(r(0));
    Object.defineProperty(t, "__esModule", {
        value: !0
    }), t.setBgOptions = t.getBgOptions = t.tellBGbroadcastMsgFromPipe = t.setUserInfo = t.keepSetHeader = t.unsetHeader = t.setHeader = t.fetchTheDom = t.EVENTS = void 0;
    var o, a, i, s, u, c, l, f, d = r(4),
        p = (0, n.default)(d),
        h = r(5),
        v = (0, n.default)(h);
    t.fetchTheDom = (o = (0, v.default)(p.default.mark((function e(t) {
        var r;
        return p.default.wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
                case 0:
                    return e.next = 2, b(m.FETCH_DOM, t);
                case 2:
                    return r = e.sent, e.abrupt("return", r);
                case 4:
                case "end":
                    return e.stop()
            }
        }), e)
    }))), function (e) {
        return o.apply(this, arguments)
    }), t.setHeader = (a = (0, v.default)(p.default.mark((function e(t) {
        var r;
        return p.default.wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
                case 0:
                    return e.next = 2, b(m.SET_HEADER, t);
                case 2:
                    return r = e.sent, e.abrupt("return", r);
                case 4:
                case "end":
                    return e.stop()
            }
        }), e)
    }))), function (e) {
        return a.apply(this, arguments)
    }), t.unsetHeader = (i = (0, v.default)(p.default.mark((function e(t) {
        var r;
        return p.default.wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
                case 0:
                    return e.next = 2, b(m.UNSET_HEADER, t);
                case 2:
                    return r = e.sent, e.abrupt("return", r);
                case 4:
                case "end":
                    return e.stop()
            }
        }), e)
    }))), function (e) {
        return i.apply(this, arguments)
    }), t.keepSetHeader = (s = (0, v.default)(p.default.mark((function e(t) {
        var r;
        return p.default.wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
                case 0:
                    return e.next = 2, b(m.KEEP_SET_HEADER, t);
                case 2:
                    return r = e.sent, e.abrupt("return", r);
                case 4:
                case "end":
                    return e.stop()
            }
        }), e)
    }))), function (e) {
        return s.apply(this, arguments)
    }), t.setUserInfo = (u = (0, v.default)(p.default.mark((function e(t) {
        var r;
        return p.default.wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
                case 0:
                    return e.next = 2, b(m.SET_USER_INFO, t);
                case 2:
                    return r = e.sent, e.abrupt("return", r);
                case 4:
                case "end":
                    return e.stop()
            }
        }), e)
    }))), function (e) {
        return u.apply(this, arguments)
    }), t.tellBGbroadcastMsgFromPipe = (c = (0, v.default)(p.default.mark((function e(t) {
        return p.default.wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
                case 0:
                    b(m.MESSAGEPIPE, t);
                case 1:
                case "end":
                    return e.stop()
            }
        }), e)
    }))), function (e) {
        return c.apply(this, arguments)
    }), t.getBgOptions = (l = (0, v.default)(p.default.mark((function e() {
        var t;
        return p.default.wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
                case 0:
                    return e.next = 2, b(m.GET_BG_OPTIONS);
                case 2:
                    return t = e.sent, e.abrupt("return", t);
                case 4:
                case "end":
                    return e.stop()
            }
        }), e)
    }))), function () {
        return l.apply(this, arguments)
    }), t.setBgOptions = (f = (0, v.default)(p.default.mark((function e(t) {
        return p.default.wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
                case 0:
                    b(m.SET_BG_OPTIONS, t);
                case 1:
                case "end":
                    return e.stop()
            }
        }), e)
    }))), function (e) {
        return f.apply(this, arguments)
    });
    t.onMessage = function (e, t) {
        g.runtime.onMessage.addListener((function (r, n, o) {
            var a = r.eventName,
                i = r.data;
            return a === e && (t(i, o), !0)
        }))
    }, t.sendMessage = b;
    var g = navigator.userAgent.includes("Chrome") ? chrome : browser,
        m = t.EVENTS = {
            FETCH_DOM: "FETCH_DOM",
            SET_HEADER: "ADD_HEADER",
            UNSET_HEADER: "UNSET_HEADER",
            KEEP_SET_HEADER: "KEEP_SET_HEADER",
            BLOCK_ONE_DOMAIN: "BLOCK_ONE_DOMAIN",
            SET_SPEEDUP_REC: "SET_SPEEDUP_REC",
            SET_USER_INFO: "SET_USER_INFO",
            DLM_NEW_TASK: "DLM_NEW_TASK",
            ISAP: "IS_ACTIVE_MEMBER",
            MESSAGEPIPE: "MESSAGEPIPE",
            BROADCASTPIPEMESSAGE: "BROADCASTPIPEMESSAGE",
            GET_BG_OPTIONS: "GET_BG_OPTIONS",
            SET_BG_OPTIONS: "SET_BG_OPTIONS"
        };

    function b(e, t) {
        return new Promise((function (r) {
            g.runtime.sendMessage({
                eventName: e,
                data: t
            }, (function (e) {
                r(e)
            }))
        }))
    }
}, function (e, t, r) {
    var n = function (e) {
        "use strict";
        var t, r = Object.prototype,
            n = r.hasOwnProperty,
            o = "function" == typeof Symbol ? Symbol : {},
            a = o.iterator || "@@iterator",
            i = o.asyncIterator || "@@asyncIterator",
            s = o.toStringTag || "@@toStringTag";

        function u(e, t, r, n) {
            var o = t && t.prototype instanceof v ? t : v,
                a = Object.create(o.prototype),
                i = new I(n || []);
            return a._invoke = function (e, t, r) {
                var n = l;
                return function (o, a) {
                    if (n === d) throw new Error("Generator is already running");
                    if (n === p) {
                        if ("throw" === o) throw a;
                        return N()
                    }
                    for (r.method = o, r.arg = a;;) {
                        var i = r.delegate;
                        if (i) {
                            var s = _(i, r);
                            if (s) {
                                if (s === h) continue;
                                return s
                            }
                        }
                        if ("next" === r.method) r.sent = r._sent = r.arg;
                        else if ("throw" === r.method) {
                            if (n === l) throw n = p, r.arg;
                            r.dispatchException(r.arg)
                        } else "return" === r.method && r.abrupt("return", r.arg);
                        n = d;
                        var u = c(e, t, r);
                        if ("normal" === u.type) {
                            if (n = r.done ? p : f, u.arg === h) continue;
                            return {
                                value: u.arg,
                                done: r.done
                            }
                        }
                        "throw" === u.type && (n = p, r.method = "throw", r.arg = u.arg)
                    }
                }
            }(e, r, i), a
        }

        function c(e, t, r) {
            try {
                return {
                    type: "normal",
                    arg: e.call(t, r)
                }
            } catch (e) {
                return {
                    type: "throw",
                    arg: e
                }
            }
        }
        e.wrap = u;
        var l = "suspendedStart",
            f = "suspendedYield",
            d = "executing",
            p = "completed",
            h = {};

        function v() {}

        function g() {}

        function m() {}
        var b = {};
        b[a] = function () {
            return this
        };
        var y = Object.getPrototypeOf,
            E = y && y(y(A([])));
        E && E !== r && n.call(E, a) && (b = E);
        var S = m.prototype = v.prototype = Object.create(b);

        function w(e) {
            ["next", "throw", "return"].forEach((function (t) {
                e[t] = function (e) {
                    return this._invoke(t, e)
                }
            }))
        }

        function T(e) {
            var t;
            this._invoke = function (r, o) {
                function a() {
                    return new Promise((function (t, a) {
                        ! function t(r, o, a, i) {
                            var s = c(e[r], e, o);
                            if ("throw" !== s.type) {
                                var u = s.arg,
                                    l = u.value;
                                return l && "object" == typeof l && n.call(l, "__await") ? Promise.resolve(l.__await).then((function (e) {
                                    t("next", e, a, i)
                                }), (function (e) {
                                    t("throw", e, a, i)
                                })) : Promise.resolve(l).then((function (e) {
                                    u.value = e, a(u)
                                }), (function (e) {
                                    return t("throw", e, a, i)
                                }))
                            }
                            i(s.arg)
                        }(r, o, t, a)
                    }))
                }
                return t = t ? t.then(a, a) : a()
            }
        }

        function _(e, r) {
            var n = e.iterator[r.method];
            if (n === t) {
                if (r.delegate = null, "throw" === r.method) {
                    if (e.iterator.return && (r.method = "return", r.arg = t, _(e, r), "throw" === r.method)) return h;
                    r.method = "throw", r.arg = new TypeError("The iterator does not provide a 'throw' method")
                }
                return h
            }
            var o = c(n, e.iterator, r.arg);
            if ("throw" === o.type) return r.method = "throw", r.arg = o.arg, r.delegate = null, h;
            var a = o.arg;
            return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, h) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, h)
        }

        function x(e) {
            var t = {
                tryLoc: e[0]
            };
            1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t)
        }

        function O(e) {
            var t = e.completion || {};
            t.type = "normal", delete t.arg, e.completion = t
        }

        function I(e) {
            this.tryEntries = [{
                tryLoc: "root"
            }], e.forEach(x, this), this.reset(!0)
        }

        function A(e) {
            if (e) {
                var r = e[a];
                if (r) return r.call(e);
                if ("function" == typeof e.next) return e;
                if (!isNaN(e.length)) {
                    var o = -1,
                        i = function r() {
                            for (; ++o < e.length;)
                                if (n.call(e, o)) return r.value = e[o], r.done = !1, r;
                            return r.value = t, r.done = !0, r
                        };
                    return i.next = i
                }
            }
            return {
                next: N
            }
        }

        function N() {
            return {
                value: t,
                done: !0
            }
        }
        return g.prototype = S.constructor = m, m.constructor = g, m[s] = g.displayName = "GeneratorFunction", e.isGeneratorFunction = function (e) {
            var t = "function" == typeof e && e.constructor;
            return !!t && (t === g || "GeneratorFunction" === (t.displayName || t.name))
        }, e.mark = function (e) {
            return Object.setPrototypeOf ? Object.setPrototypeOf(e, m) : (e.__proto__ = m, s in e || (e[s] = "GeneratorFunction")), e.prototype = Object.create(S), e
        }, e.awrap = function (e) {
            return {
                __await: e
            }
        }, w(T.prototype), T.prototype[i] = function () {
            return this
        }, e.AsyncIterator = T, e.async = function (t, r, n, o) {
            var a = new T(u(t, r, n, o));
            return e.isGeneratorFunction(r) ? a : a.next().then((function (e) {
                return e.done ? e.value : a.next()
            }))
        }, w(S), S[s] = "Generator", S[a] = function () {
            return this
        }, S.toString = function () {
            return "[object Generator]"
        }, e.keys = function (e) {
            var t = [];
            for (var r in e) t.push(r);
            return t.reverse(),
                function r() {
                    for (; t.length;) {
                        var n = t.pop();
                        if (n in e) return r.value = n, r.done = !1, r
                    }
                    return r.done = !0, r
                }
        }, e.values = A, I.prototype = {
            constructor: I,
            reset: function (e) {
                if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(O), !e)
                    for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t)
            },
            stop: function () {
                this.done = !0;
                var e = this.tryEntries[0].completion;
                if ("throw" === e.type) throw e.arg;
                return this.rval
            },
            dispatchException: function (e) {
                if (this.done) throw e;
                var r = this;

                function o(n, o) {
                    return s.type = "throw", s.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o
                }
                for (var a = this.tryEntries.length - 1; a >= 0; --a) {
                    var i = this.tryEntries[a],
                        s = i.completion;
                    if ("root" === i.tryLoc) return o("end");
                    if (i.tryLoc <= this.prev) {
                        var u = n.call(i, "catchLoc"),
                            c = n.call(i, "finallyLoc");
                        if (u && c) {
                            if (this.prev < i.catchLoc) return o(i.catchLoc, !0);
                            if (this.prev < i.finallyLoc) return o(i.finallyLoc)
                        } else if (u) {
                            if (this.prev < i.catchLoc) return o(i.catchLoc, !0)
                        } else {
                            if (!c) throw new Error("try statement without catch or finally");
                            if (this.prev < i.finallyLoc) return o(i.finallyLoc)
                        }
                    }
                }
            },
            abrupt: function (e, t) {
                for (var r = this.tryEntries.length - 1; r >= 0; --r) {
                    var o = this.tryEntries[r];
                    if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
                        var a = o;
                        break
                    }
                }
                a && ("break" === e || "continue" === e) && a.tryLoc <= t && t <= a.finallyLoc && (a = null);
                var i = a ? a.completion : {};
                return i.type = e, i.arg = t, a ? (this.method = "next", this.next = a.finallyLoc, h) : this.complete(i)
            },
            complete: function (e, t) {
                if ("throw" === e.type) throw e.arg;
                return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), h
            },
            finish: function (e) {
                for (var t = this.tryEntries.length - 1; t >= 0; --t) {
                    var r = this.tryEntries[t];
                    if (r.finallyLoc === e) return this.complete(r.completion, r.afterLoc), O(r), h
                }
            },
            catch: function (e) {
                for (var t = this.tryEntries.length - 1; t >= 0; --t) {
                    var r = this.tryEntries[t];
                    if (r.tryLoc === e) {
                        var n = r.completion;
                        if ("throw" === n.type) {
                            var o = n.arg;
                            O(r)
                        }
                        return o
                    }
                }
                throw new Error("illegal catch attempt")
            },
            delegateYield: function (e, r, n) {
                return this.delegate = {
                    iterator: A(e),
                    resultName: r,
                    nextLoc: n
                }, "next" === this.method && (this.arg = t), h
            }
        }, e
    }(e.exports);
    try {
        regeneratorRuntime = n
    } catch (e) {
        Function("r", "regeneratorRuntime = r")(n)
    }
}, , function (e, t, r) {
    var n = r(14),
        o = r(15),
        a = r(16);
    e.exports = function (e) {
        return n(e) || o(e) || a()
    }
}, , , , function (e, t, r) {
    "use strict";
    var n, o, a, i, s, u, c, l = r(0)(r(0)),
        f = r(9),
        d = (0, l.default)(f),
        p = r(4),
        h = (0, l.default)(p),
        v = r(5),
        g = (0, l.default)(v),
        m = r(17),
        b = (0, l.default)(m),
        y = (n = (0, g.default)(h.default.mark((function e(t) {
            var r, n, o, a, i, s, u, c;
            return h.default.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                    case 0:
                        return r = t.url, n = t.domLabel, o = t.reqInit, a = t.fetchTimeout, i = t.retryCount, e.next = 3, (0, N.fetch_retry)(r, o, a, i).then((function (e) {
                            if (e.ok) return e.text();
                            throw new Error(e.statusText)
                        })).then((function (e) {
                            if (u = e, n) {
                                var t = (new DOMParser).parseFromString(e, "text/html");
                                s = t.querySelector(n), c = {}
                            }
                        })).catch((function (e) {
                            return console.log("failed fetch page: ", r, e), c = {
                                url: r,
                                err: e.toString()
                            }, !1
                        }));
                    case 3:
                        if (c) {
                            e.next = 7;
                            break
                        }
                        return e.abrupt("return", {
                            dom: s,
                            originHtml: u
                        });
                    case 7:
                        return e.abrupt("return", c);
                    case 8:
                    case "end":
                        return e.stop()
                }
            }), e)
        }))), function (e) {
            return n.apply(this, arguments)
        }),
        E = (o = (0, g.default)(h.default.mark((function e(t) {
            var r, n, o;
            return h.default.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                    case 0:
                        return e.next = 2, y(t);
                    case 2:
                        if (!(r = e.sent).hasOwnProperty("err")) {
                            e.next = 5;
                            break
                        }
                        return e.abrupt("return", r);
                    case 5:
                        if (n = r.dom, o = r.originHtml, !t.domLabel) {
                            e.next = 11;
                            break
                        }
                        if (!n) {
                            e.next = 9;
                            break
                        }
                        return e.abrupt("return", n.innerHTML);
                    case 9:
                        e.next = 13;
                        break;
                    case 11:
                        if (!o) {
                            e.next = 13;
                            break
                        }
                        return e.abrupt("return", o);
                    case 13:
                    case "end":
                        return e.stop()
                }
            }), e)
        }))), function (e) {
            return o.apply(this, arguments)
        }),
        S = (a = (0, g.default)(h.default.mark((function e(t, r) {
            var n, o, a, i, s, u, c;
            return h.default.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                    case 0:
                        for (n = t.oneHeadDomain, o = t.oneHeadValue, q.push(n), a = 0, i = Object.entries(o); a < i.length; a++) s = (0, b.default)(i[a], 2), u = s[0], c = s[1], z[u] = c;
                        W(), t.keepTime && (j = window.setTimeout(V, t.keepTime));
                    case 5:
                    case "end":
                        return e.stop()
                }
            }), e)
        }))), function (e, t) {
            return a.apply(this, arguments)
        }),
        w = (i = (0, g.default)(h.default.mark((function e(t, r) {
            var n;
            return h.default.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                    case 0:
                        return e.next = 2, E(t);
                    case 2:
                        n = e.sent, r({
                            type: "repDom",
                            theFetchResp: n
                        });
                    case 5:
                    case "end":
                        return e.stop()
                }
            }), e)
        }))), function (e, t) {
            return i.apply(this, arguments)
        }),
        T = (s = (0, g.default)(h.default.mark((function e(t) {
            var r, n, o, a, i;
            return h.default.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                    case 0:
                        r = t.oneDomain, n = t.tabId, o = t.mediaId, a = t.oneEleIndex, delete L[o][a], U(n), (i = JSON.parse(localStorage.BlockedDomains)).push(r), i = (0, d.default)(new Set(i)), localStorage.BlockedDomains = JSON.stringify(i);
                    case 7:
                    case "end":
                        return e.stop()
                }
            }), e)
        }))), function (e) {
            return s.apply(this, arguments)
        }),
        _ = (u = (0, g.default)(h.default.mark((function e(t) {
            var r, n;
            return h.default.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                    case 0:
                        r = t.tabId, t.checked ? (n = "if(!window.changeTime){videoTimeHook_(window)}else{console.log('videoTimeHook_ inited')};", D.tabs.executeScript(r, {
                            code: n,
                            allFrames: !0,
                            runAt: "document_idle"
                        }, J("tabs.executeScript.on.setSpeedUpRecDiv")), n = "changeTime(2, 0, true);", D.tabs.executeScript(r, {
                            code: n,
                            allFrames: !0,
                            runAt: "document_idle"
                        }, J("tabs.executeScript.on.setSpeedUpRecDiv"))) : D.tabs.executeScript(r, {
                            code: "changeTime(0, 0, false, true);",
                            allFrames: !0,
                            runAt: "document_idle"
                        }, J("tabs.executeScript.on.setSpeedUpRecDiv"));
                    case 2:
                    case "end":
                        return e.stop()
                }
            }), e)
        }))), function (e) {
            return u.apply(this, arguments)
        }),
        x = (c = (0, g.default)(h.default.mark((function e(t) {
            return h.default.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                    case 0:
                        t ? localStorage.setItem("pui", t) : localStorage.removeItem("pui");
                    case 1:
                    case "end":
                        return e.stop()
                }
            }), e)
        }))), function (e) {
            return c.apply(this, arguments)
        }),
        O = r(3),
        I = r(21),
        A = r(6),
        N = r(1);
    (0, O.doInit)();
    var L = L || new Array;
    window.mediaurls = L;
    var P = new Array,
        D = navigator.userAgent.includes("Chrome") ? chrome : browser;
    (0, I.doHlsParsefunction)();
    var M = ["$", "^", "[", "]", "(", ")", "{", "}", "|", "+", ".", "\\"];

    function R(e, t) {
        for (var r = "^", n = 0; n < e.length; n++) {
            var o = e.charAt(n);
            if (k(o)) r += "\\" + o;
            else switch (o) {
                case "*":
                    r += ".*";
                    break;
                case "?":
                    r += ".{0,1}";
                    break;
                default:
                    r += o
            }
        }
        return r += "$", null != t.match(r)
    }

    function k(e) {
        for (var t in M)
            if (e == t) return !0;
        return !1
    }

    function U(e) {
        console.log("updateBadgetAndIcon");
        var t = L["tabid" + e].reduce((function (e) {
            return e + 1
        }), 0);
        t > 0 ? (D.browserAction.setIcon({
            path: {
                16: "assets/icons/16x16.png",
                32: "assets/icons/32x32.png",
                48: "assets/icons/48x48.png",
                64: "assets/icons/64x64.png",
                128: "assets/icons/128x128.png"
            },
            tabId: e
        }), "true" == localStorage.showCountOnIcon && D.browserAction.setBadgeText({
            text: t.toString(),
            tabId: e
        }), D.browserAction.setTitle({
            title: (0, O.t)("TbadgetTitle", [t]),
            tabId: e
        })) : (D.browserAction.setIcon({
            path: {
                16: "assets/icons/16x16_gray.png",
                32: "assets/icons/32x32_gray.png",
                48: "assets/icons/48x48_gray.png",
                64: "assets/icons/64x64_gray.png",
                128: "assets/icons/128x128_gray.png"
            }
        }), D.browserAction.setBadgeText({
            text: "",
            tabId: e
        }), D.browserAction.setTitle({
            title: "CocoCut",
            tabId: e
        }))
    }

    function C(e) {
        var t = e.split("?");
        return (t = (t = t[0].split("/"))[t.length - 1].split("#"))[0].toLowerCase()
    }

    function H(e) {
        var t = e.split(".");
        if (1 == t.length) return null;
        var r = t[t.length - 1];
        return (r = r.match(/[0-9a-zA-Z]*/))[0].toLowerCase()
    }

    function B(e, t) {
        e = e.toLowerCase();
        for (var r = 0; r < t.responseHeaders.length; r++)
            if (t.responseHeaders[r].name.toLowerCase() == e) return t.responseHeaders[r].value.toLowerCase();
        return null
    }

    function G(e, t, r) {
        e = e.toLowerCase();
        for (var n = 0; n < r.responseHeaders.length; n++) r.responseHeaders[n].name.toLowerCase() == e && (r.responseHeaders[n].value = t)
    }
    D.webRequest.onResponseStarted.addListener((function (e) {
        ! function (e) {
            if (-1 == e.tabId) return;
            if (!I.tabs[e.tabId]) return;
            if (-1 !== I.tabs[e.tabId].url.indexOf("cnbbx.com")) return;
            if (O.DISABLE_DOWNLOADING_FROM_YOUTUBE_REGEXP.exec(I.tabs[e.tabId].url)) return void(I.tabs[e.tabId].url.indexOf("/watch") > -1 && (0, O.isActivePro)() && (D.browserAction.setIcon({
                path: {
                    16: "assets/icons/16x16.png",
                    32: "assets/icons/32x32.png",
                    48: "assets/icons/48x48.png",
                    64: "assets/icons/64x64.png",
                    128: "assets/icons/128x128.png"
                },
                tabId: e.tabId
            }), D.browserAction.setBadgeText({
                text: "1",
                tabId: e.tabId
            })));
            if (t = "tabid" + e.tabId, (L[t] ? L[t].length : 0) >= Number(localStorage.popListCount)) return;
            var t;
            var r = B("content-length", e),
                n = C(e.url),
                o = H(n),
                a = B("content-type", e);
            "true" == localStorage.Debug && console.log({
                name: n,
                url: e.url,
                size: r,
                ext: o,
                type: a,
                tabid: e.tabId,
                all: e
            });
            var i = new URL(e.url),
                s = JSON.parse(localStorage.BlockedDomains);
            for (l = 0; l < s.length; l++) {
                var u = s[l].toLowerCase();
                if (i.host == u) return
            }
            P = JSON.parse(localStorage[O.PRE_DEF_EXTS]);
            for (var c = !1, l = 0; l < P.length; l++) {
                if (-1 != P[l].ext.toLowerCase().indexOf(o)) {
                    if (0 == P[l].size || r >= 1024 * P[l].size || null == r) {
                        c = !0, "ts" == o && null == r && (c = !1);
                        break
                    }
                    return
                }
            }
            if (null != a && !c) {
                var f = JSON.parse(localStorage.Type);
                for (l = 0; l < f.length; l++) {
                    if (R(f[l].Type.toLowerCase(), a)) {
                        if (0 == f[l].size || r >= 1024 * f[l].size || null == r) {
                            c = !0;
                            break
                        }
                        return
                    }
                }
            }
            var d = B("Content-Disposition", e);
            if (d) {
                var p = d.match(/filename="(.*?)"/);
                if (p && p[1]) {
                    n = C(n = decodeURIComponent(p[1])), o = H(n);
                    for (l = 0; l < P.length; l++) {
                        if (-1 != P[l].ext.toLowerCase().indexOf(o)) {
                            c = !0;
                            break
                        }
                    }
                }
            }
            if (c) {
                var h = e.url,
                    v = h,
                    g = "tabid" + e.tabId,
                    m = new RegExp(localStorage.repeatReg, "g");
                "true" == localStorage.repeat && (v = v.replace(m, "")), null == L[g] && (L[g] = []);
                for (var b = 0; b < L[g].length; b++) {
                    var y = L[g][b].url;
                    if ("true" == localStorage.repeat && (y = y.replace(m, "")), y == v) return
                }
                D.tabs.get(e.tabId, (function (t) {
                    if (D.runtime.lastError) {
                        var i = D.runtime.lastError.message;
                        console.info(i)
                    }
                    var s;
                    t && (s = t.title),
                        function () {
                            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "*******";
                            r = Math.round(100 * r / 1024 / 1024) / 100 + "MB";
                            var i = {
                                name: n,
                                url: h,
                                size: r,
                                ext: o,
                                type: a,
                                tabid: e.tabId,
                                title: t,
                                mediaid: g
                            };
                            L[g].push(i), D.runtime.sendMessage(i), U(e.tabId)
                        }(s)
                }))
            }
        }(e)
    }), {
        urls: ["http://*/*", "https://*/*"]
    }, ["responseHeaders"]), D.tabs.onUpdated.addListener((function (e, t) {
        if ("loading" == t.status) {
            var r = "tabid" + e;
            L[r] && (L[r] = [])
        }
    })), D.tabs.onRemoved.addListener((function (e) {
        var t = "tabid" + e;
        L[t] && delete L[t]
    }));
    var j, q = [],
        z = {};

    function F(e) {
        var t = !0,
            r = !1,
            n = void 0;
        try {
            for (var o, a = q[Symbol.iterator](); !(t = (o = a.next()).done); t = !0) {
                var i = o.value;
                if (-1 != e.url.indexOf(i)) {
                    for (var s = 0, u = Object.entries(z); s < u.length; s++) {
                        var c = (0, b.default)(u[s], 2),
                            l = c[0],
                            f = c[1]; - 1 !== l.indexOf("SetItse2-") ? G(l = l.split("SetItse2-")[1], f, e) : e.responseHeaders.push({
                            name: l,
                            value: f
                        })
                    }
                    return {
                        responseHeaders: e.responseHeaders
                    }
                }
            }
        } catch (e) {
            r = !0, n = e
        } finally {
            try {
                t || null == a.return || a.return()
            } finally {
                if (r) throw n
            }
        }
    }

    function W() {
        q && z && D.webRequest.onHeadersReceived.addListener(F, {
            urls: ["<all_urls>"]
        }, ["responseHeaders", "blocking"])
    }

    function V() {
        D.webRequest.onHeadersReceived.removeListener(F)
    }
    var J = function (e) {
            return function () {
                return !!D.runtime.lastError && (console.log("[" + e + "] WebExtensions.runtime.lastError => " + D.runtime.lastError.message), !0)
            }
        },
        Y = function () {
            var e = localStorage.option,
                t = {
                    counter: 0,
                    domain: {}
                };
            try {
                e && Object.assign(t, JSON.parse(e)), t.counter = Math.max(0, Math.floor(Number(t.counter) || 0)), t.rcounterr = Math.max(0, Math.floor(Number(t.rcounterr) || 0)), localStorage.option = JSON.stringify(t)
            } catch (e) {
                console.log(e.stack)
            }
            return t
        },
        K = function (e) {
            localStorage.option = JSON.stringify(e)
        };
    (0, A.onMessage)(A.EVENTS.SET_HEADER, (function (e, t) {
        S(e, t)
    })), (0, A.onMessage)(A.EVENTS.FETCH_DOM, (function (e, t) {
        w(e, t)
    })), (0, A.onMessage)(A.EVENTS.UNSET_HEADER, (function (e, t) {
        V()
    })), (0, A.onMessage)(A.EVENTS.KEEP_SET_HEADER, (function (e, t) {
        ! function () {
            var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1e4;
            j && (window.clearTimeout(j), j = window.setTimeout(V, e))
        }(e.keepTime)
    })), (0, A.onMessage)(A.EVENTS.BLOCK_ONE_DOMAIN, (function (e, t) {
        T(e)
    })), (0, A.onMessage)(A.EVENTS.SET_SPEEDUP_REC, (function (e, t) {
        _(e)
    })), (0, A.onMessage)(A.EVENTS.SET_USER_INFO, (function (e, t) {
        x(e)
    })), (0, A.onMessage)(A.EVENTS.DLM_NEW_TASK, (function (e, t) {
        var r;
        r = O.PROENV && e.url.startsWith("https://") ? "https" : "http";
        var n = 2;
        (0, O.isActivePro)() && (n = 4), startNewDl(e.url, r + (0, O.getDLMUrl)(), n)
    })), (0, A.onMessage)(A.EVENTS.ISAP, (function (e, t) {
        t((0, O.isActivePro)())
    })), (0, A.onMessage)(A.EVENTS.MESSAGEPIPE, (function (e, t) {
        var r = {
            eventName: A.EVENTS.BROADCASTPIPEMESSAGE,
            data: e
        };
        D.tabs.query({}, (function (e) {
            for (var t = 0; t < e.length; ++t) D.tabs.sendMessage(e[t].id, r)
        }))
    })), (0, A.onMessage)(A.EVENTS.GET_BG_OPTIONS, (function (e, t) {
        t(Y())
    })), (0, A.onMessage)(A.EVENTS.SET_BG_OPTIONS, (function (e, t) {
        K(e)
    })), fetch(O.HOMEPAGE + "/pub/config/config.json?v=" + Date.now()).then((function (e) {
        return e.json()
    })).then((function (e) {
        if (e.serverNotice && localStorage.setItem("serverNotice", e.serverNotice), e.recltime) {
            var t = Y();
            t.recltime = e.recltime, K(t)
        }
    })).catch((function (e) {
        console.log("error:", e)
    }))
}, function (e, t) {
    e.exports = function (e) {
        if (Array.isArray(e)) {
            for (var t = 0, r = new Array(e.length); t < e.length; t++) r[t] = e[t];
            return r
        }
    }
}, function (e, t) {
    e.exports = function (e) {
        if (Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e)) return Array.from(e)
    }
}, function (e, t) {
    e.exports = function () {
        throw new TypeError("Invalid attempt to spread non-iterable instance")
    }
}, function (e, t, r) {
    var n = r(18),
        o = r(19),
        a = r(20);
    e.exports = function (e, t) {
        return n(e) || o(e, t) || a()
    }
}, function (e, t) {
    e.exports = function (e) {
        if (Array.isArray(e)) return e
    }
}, function (e, t) {
    e.exports = function (e, t) {
        if (Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e)) {
            var r = [],
                n = !0,
                o = !1,
                a = void 0;
            try {
                for (var i, s = e[Symbol.iterator](); !(n = (i = s.next()).done) && (r.push(i.value), !t || r.length !== t); n = !0);
            } catch (e) {
                o = !0, a = e
            } finally {
                try {
                    n || null == s.return || s.return()
                } finally {
                    if (o) throw a
                }
            }
            return r
        }
    }
}, function (e, t) {
    e.exports = function () {
        throw new TypeError("Invalid attempt to destructure non-iterable instance")
    }
}, function (e, t, r) {
    "use strict";
    var n = r(0)(r(0));
    Object.defineProperty(t, "__esModule", {
        value: !0
    }), t.tabs = void 0;
    var o = r(4),
        a = (0, n.default)(o),
        i = r(5),
        s = (0, n.default)(i),
        u = r(22),
        c = (0, n.default)(u),
        l = r(23),
        f = (0, n.default)(l),
        d = r(9),
        p = (0, n.default)(d),
        h = r(24);
    (0, n.default)(h);
    t.doHlsParsefunction = function () {
        console.log("hlsParser");
        var e = {
                pure: function (e) {
                    return e.match(/[^#]+/)[0]
                },
                domain: function (e) {
                    return (e.match(/https?:\/\/([^\/]+)/) || [])[1]
                },
                filename: function (e) {
                    return ((e.match(/[^\/]+$/) || [])[0] || "").match(/^[^\?&#]*/)[0]
                },
                flatten: function (e) {
                    return e.replace(/^https?:/, "").replace(/[^A-Za-z0-9]/g, "X")
                }
            },
            t = function (e, t) {
                var r = !0,
                    n = !1,
                    o = void 0;
                try {
                    for (var a, i = e[Symbol.iterator](); !(r = (a = i.next()).done); r = !0) {
                        var s = a.value;
                        if (s.name.toLowerCase() === t) return s.value.toLowerCase()
                    }
                } catch (e) {
                    n = !0, o = e
                } finally {
                    try {
                        r || null == i.return || i.return()
                    } finally {
                        if (n) throw o
                    }
                }
                return ""
            },
            r = function (e) {
                var t = e % 64;
                return "color:#" + ((t >> 4 & 3) << 22 | (t >> 2 & 3) << 14 | (3 & t) << 6 | 1048576).toString(16)
            },
            n = function (e, t, n) {
                return e ? ["tabId %c" + e + "%c [" + t + "]%c " + n, r(e), "color:#f60b91", ""] : ["%c%c[" + t + "]%c " + n, r(e), "color:#f60b91", ""]
            },
            o = function (e) {
                return ["%c" + e, "color:#ff0000"]
            };
        var i, u = localStorage.log,
            l = (localStorage.log, navigator.userAgent.includes("Chrome") ? chrome : browser),
            d = l.runtime.getManifest(),
            h = (l.i18n, (0, v.getLanguage)(), navigator.userAgent.includes("Edge")),
            m = !h && navigator.userAgent.includes("Firefox"),
            b = (!h && navigator.userAgent.includes("Chrome") && Number((navigator.userAgent.match(/Chrome\/(\d+)/) || [])[1] || 0) || 0) < 72 ? ["blocking", "requestHeaders"] : ["blocking", "requestHeaders", "extraHeaders"],
            y = {
                STOPPED: 1,
                RUNNING: 2
            },
            E = {
                NORMAL: 1,
                GREED: 2,
                WATCH: 3,
                CAPTURE: 4,
                TEST: 99
            },
            S = {
                M3U8: 1,
                TS: 2,
                DASH: 3,
                MEDIASTREAM: 4,
                M3U8_CANDIDATE: 99
            },
            w = {
                SPEED: "speed",
                MEMORY: "memory"
            },
            T = function (e) {
                localStorage.option = JSON.stringify(e)
            },
            _ = function (e) {
                return function () {
                    if (l.runtime.lastError) {
                        var t;
                        if (u)(t = console).log.apply(t, (0, p.default)(o("[" + e + "] WebExtensions.runtime.lastError => " + l.runtime.lastError.message)));
                        return !0
                    }
                    return !1
                }
            };
        u && (i = console).log.apply(i, (0, p.default)(n(null, d.name, d.version + " start")));
        var x, O = function () {
            var e = localStorage.option,
                t = {
                    counter: 0,
                    priority: w.SPEED,
                    domain: {},
                    rcounterr: 0
                };
            try {
                e && Object.assign(t, JSON.parse(e)), t.counter = Math.max(0, Math.floor(Number(t.counter) || 0)), t.rcounterr = Math.max(0, Math.floor(Number(t.rcounterr) || 0)), localStorage.option = JSON.stringify(t)
            } catch (e) {
                var r;
                (r = console).log.apply(r, (0, p.default)(o(e.stack)))
            }
            return t
        }();
        u && (x = console).log.apply(x, (0, p.default)(n(null, "option", JSON.stringify(O))));
        var I = function () {
            function e(t, r) {
                (0, c.default)(this, e);
                var n = r.url,
                    o = r.parentTabId,
                    a = r.childTabId;
                for (var i in this.id = t, this.url = n || "", this.parentTabId = o || null, this.childTabId = a || null, this.ignoreDisconnectOnce = !1, this.frames = {}, this.requestHeaders = {}, this.que = {}, S) this.que[S[i]] = [];
                this.actionButtonStatus = "", this.stat = y.STOPPED, this.mode = E.NORMAL, this.storedBlob = {}
            }
            var t, r, i;
            return (0, f.default)(e, [{
                key: "push",
                value: function (e, t) {
                    var r = this.que[e];
                    if (r && !(r.length >= 100)) {
                        t.header = function (e) {
                            var t = {};
                            if (e) {
                                var r = !0,
                                    n = !1,
                                    o = void 0;
                                try {
                                    for (var a, i = e[Symbol.iterator](); !(r = (a = i.next()).done); r = !0) {
                                        var s = a.value;
                                        t[s.name] = s.value
                                    }
                                } catch (e) {
                                    n = !0, o = e
                                } finally {
                                    try {
                                        r || null == i.return || i.return()
                                    } finally {
                                        if (n) throw o
                                    }
                                }
                            }
                            return t
                        }(t.header);
                        for (var n = 0, o = r.length; n < o; n++) {
                            var a = r[n];
                            if (a.url === t.url && a.referer === t.referer && JSON.stringify(a.header) === JSON.stringify(t.header)) return
                        }
                        t.sent = !1, r.push(t), this.stat === y.RUNNING && this.mode === E.NORMAL && this.consume()
                    }
                }
            }, {
                key: "consume",
                value: (i = (0, s.default)(a.default.mark((function e(t) {
                    var r;
                    return a.default.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                            case 0:
                                r = this.que[S.M3U8].filter((function (e) {
                                    return !e.sent
                                })), t && 0 === r.length && (r = this.que[S.M3U8_CANDIDATE].filter((function (e) {
                                    return !e.sent
                                }))), this.sendMessage("udpate_index", {
                                    type: S.M3U8,
                                    que: r
                                }), r.forEach((function (e) {
                                    e.sent = !0
                                }));
                            case 4:
                            case "end":
                                return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return i.apply(this, arguments)
                })
            }, {
                key: "start",
                value: (r = (0, s.default)(a.default.mark((function e(t) {
                    var r;
                    return a.default.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                            case 0:
                                u && (r = console).log.apply(r, (0, p.default)(n(this.id, "Tab.start", ""))), this.stat = y.RUNNING, this.mode = t, this.mode === E.NORMAL && this.consume(!0), N(this.id);
                            case 5:
                            case "end":
                                return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return r.apply(this, arguments)
                })
            }, {
                key: "stop",
                value: function () {
                    var e;
                    u && (e = console).log.apply(e, (0, p.default)(n(this.id, "Tab.stop", "")));
                    this.stat = y.STOPPED
                }
            }, {
                key: "reset",
                value: function () {
                    var e;
                    u && (e = console).log.apply(e, (0, p.default)(n(this.id, "Tab.reset", "")));
                    for (var t in this.stat = y.STOPPED, this.mode = E.NORMAL, this.ignoreDisconnectOnce = !1, this.que) {
                        var r = !0,
                            o = !1,
                            a = void 0;
                        try {
                            for (var i, s = this.que[t][Symbol.iterator](); !(r = (i = s.next()).done); r = !0) {
                                i.value.sent = !1
                            }
                        } catch (e) {
                            o = !0, a = e
                        } finally {
                            try {
                                r || null == s.return || s.return()
                            } finally {
                                if (o) throw a
                            }
                        }
                    }
                    N(this.id)
                }
            }, {
                key: "destroy",
                value: function () {
                    var e;
                    u && (e = console).log.apply(e, (0, p.default)(n(this.id, "Tab.destroy", "")));
                    this.stop(), delete g[this.id];
                    var t = Object.assign({}, this.storedBlob);
                    setTimeout((function () {
                        for (var e in t) URL.revokeObjectURL(e)
                    }), 3e3)
                }
            }, {
                key: "revokeObjectURL",
                value: function (e) {
                    if (e) {
                        var t = !0,
                            r = !1,
                            n = void 0;
                        try {
                            for (var o, a = e[Symbol.iterator](); !(t = (o = a.next()).done); t = !0) {
                                var i = o.value;
                                URL.revokeObjectURL(i), delete this.storedBlob[i]
                            }
                        } catch (e) {
                            r = !0, n = e
                        } finally {
                            try {
                                t || null == a.return || a.return()
                            } finally {
                                if (r) throw n
                            }
                        }
                    }
                }
            }, {
                key: "sendMessage",
                value: function (e, t) {
                    var r, a = this;
                    u && (r = console).log.apply(r, (0, p.default)(n(this.id, "sendMessage", e)));
                    return new Promise((function (r, n) {
                        a.childTabId && a.stat === y.RUNNING ? l.tabs.sendMessage(a.childTabId, {
                            cmd: e,
                            params: t
                        }, (function (e) {
                            var t;
                            l.runtime.lastError && (t = console).log.apply(t, (0, p.default)(o("[Tab.sendMessage] WebExtensions.runtime.lastError => " + l.runtime.lastError.message)));
                            r(e)
                        })) : r()
                    }))
                }
            }, {
                key: "virtualize",
                value: function () {
                    var e = "" + this.id;
                    if (this.childTabId && g[this.childTabId] && !e.startsWith("virtual_")) {
                        var t;
                        if (delete g[e], this.id = "virtual_for_" + this.childTabId, g[this.id] = this, g[this.childTabId].parentTabId = this.id, this.mode === E.CAPTURE && l.tabs.sendMessage(this.childTabId, {
                                cmd: "intercept_ondata",
                                params: {
                                    url: "disconnect"
                                }
                            }, _("tabs.sendMessage.2x")), u)(t = console).log.apply(t, (0, p.default)(n(e, "tab.virtualize", "to " + this.id)));
                        return !0
                    }
                    return !1
                }
            }, {
                key: "isLoader",
                get: function () {
                    return this.parentTabId
                }
            }], [{
                key: "create",
                value: function (t, r) {
                    if (t) {
                        var o, a;
                        if (g[t]) {
                            if (u)(o = console).log.apply(o, (0, p.default)(n(t, "Tab.create", g[t].url + " [ EXISTS ] , ignore")))
                        } else if (g[t] = new e(t, r), u)(a = console).log.apply(a, (0, p.default)(n(t, "Tab.create", g[t].url)));
                        N(t)
                    } else {
                        var i;
                        if (u)(i = console).log.apply(i, (0, p.default)(n(t, "Tab.create", "No tabID is specified, abort.")))
                    }
                }
            }, {
                key: "remove",
                value: (t = (0, s.default)(a.default.mark((function e(t) {
                    var r, o, i, s;
                    return a.default.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                            case 0:
                                r = g[t], o = r.isLoader, r && (o ? (r.stop(), delete g[t], (i = g[r.parentTabId]) && (i.stop(), i.reset(), i.childTabId = null, (i.id + "").startsWith("virtual_") && i.destroy())) : r.mode === E.NORMAL ? r.destroy() : r.mode === E.CAPTURE && (r.destroy(), l.tabs.sendMessage(r.childTabId, {
                                    cmd: "intercept_ondata",
                                    params: {
                                        url: "disconnect"
                                    }
                                }, _("tabs.sendMessage.2xx"))), u && (s = console).log.apply(s, (0, p.default)(n(t, "Tab.remove", r.url))));
                            case 3:
                            case "end":
                                return e.stop()
                        }
                    }), e)
                }))), function (e) {
                    return t.apply(this, arguments)
                })
            }, {
                key: "find",
                value: function (t, r) {
                    if (r === e.TAB_ID) return g[t];
                    var n = ["id", "parentTabId", "childTabId"][r];
                    for (var o in g) {
                        var a = g[o];
                        if (a[n] === t) return a
                    }
                    return null
                }
            }]), e
        }();

        function A(e, t) {
            var r;
            u && (r = console).log.apply(r, (0, p.default)(n(e.id, "browserAction.onClicked", "")));
            var o = e.id,
                a = e.index,
                i = g[o];
            if (i) {
                var s = i.url;
                if (!s.startsWith("http")) return t({
                    msg: (0, v.t)("TbgTryLater")
                });
                if (i.isLoader) return t({
                    msg: (0, v.t)("TbgIsDownloading")
                });
                if (v.DISABLE_DOWNLOADING_FROM_YOUTUBE_REGEXP.exec(s)) return t({
                    msg: "Do not support this webpage"
                });
                if (i.childTabId) l.tabs.update(i.childTabId, {
                    active: !0
                }, _("tabs.update.1"));
                else {
                    var c;
                    c = v.PROENV && s.startsWith("https://") ? "https" : "http";
                    var f = (0, v.getLoaderUrl)();
                    l.tabs.create({
                        url: c + f,
                        index: a + 1,
                        active: !0
                    }, (function (e) {
                        if (!_("tabs.create")()) {
                            var t, r = e.url || e.pendingUrl;
                            if (m && (r = c + f), u)(t = console).log.apply(t, (0, p.default)(n(e.id, "browserAction.onClicked->tabs.create", "new loader tab " + r)));
                            I.create(e.id, {
                                url: r,
                                parentTabId: o
                            }), i.childTabId = e.id, O.counter++, T(O)
                        }
                    }))
                }
            }
        }
        Object.assign(I, {
            TAB_ID: 0,
            PARENT_ID: 1,
            CHILD_ID: 2
        }), l.webRequest.onBeforeRequest.addListener((function (t) {
            var r = t.tabId,
                o = e.pure(t.url),
                a = g[r];
            if (a && (a.actionButtonStatus = "", a.url === o && !a.isLoader))
                if (a.ignoreDisconnectOnce) {
                    var i;
                    if (u)(i = console).log.apply(i, (0, p.default)(n(r, "onBeforeRequest", "ignore reloading for intercept-loader")));
                    a.ignoreDisconnectOnce = !1
                } else if (a.childTabId) {
                var s;
                if (u)(s = console).log.apply(s, (0, p.default)(n(r, "onBeforeRequest", "reload, " + t.url)));
                a.virtualize() || I.remove(r), I.create(r, {
                    url: o
                })
            } else {
                var c;
                if (u)(c = console).log.apply(c, (0, p.default)(n(r, "onBeforeRequest", "ignore reloading ( has no child ), " + t.url)))
            }
        }), {
            urls: ["<all_urls>"],
            types: ["main_frame"]
        }, []), l.webRequest.onBeforeSendHeaders.addListener((function (e) {
            var t = e.requestHeaders,
                r = e.url,
                n = e.tabId,
                o = e.type,
                a = e.requestId,
                i = g[n];
            if (i && !v.DISABLE_DOWNLOADING_FROM_YOUTUBE_REGEXP.exec(r)) return i.isLoader ? O.counter < 30 && r.includes("pagead2") ? {
                cancel: !0
            } : "xmlhttprequest" === o && r.includes("cococut_promotion") ? {
                cancel: !0
            } : void 0 : (i && "xmlhttprequest" === o && (i.requestHeaders[a] = t), {
                requestHeaders: t
            })
        }), {
            urls: ["<all_urls>"]
        }, b), l.webRequest.onBeforeSendHeaders.addListener((function (e) {
            var t = e.requestHeaders,
                r = (e.url, e.tabId, e.type);
            e.requestId;
            if ("xmlhttprequest" === r)
                for (var n = 0, o = t.length; n < o; n++) {
                    var a = t[n];
                    a.name.startsWith("LM_") && (t[n] = {
                        name: a.name.substr(3),
                        value: a.value
                    })
                }
            return {
                requestHeaders: t
            }
        }), {
            urls: ["<all_urls>"]
        }, b), l.webRequest.onHeadersReceived.addListener((function (r) {
            var o = r.url,
                a = r.tabId,
                i = r.type,
                s = r.frameId,
                c = r.statusCode,
                l = r.responseHeaders,
                f = r.requestId,
                d = r.method,
                h = c >= 200 && c < 300,
                m = g[a];
            if (m && "OPTIONS" !== d) {
                if (h && !m.isLoader && !v.DISABLE_DOWNLOADING_FROM_YOUTUBE_REGEXP.exec(o)) {
                    m.frames[s] || (m.frames[s] = r.url);
                    var b = e.filename(o),
                        y = t(l, "content-type");
                    if (y.match(/(mpegurl|m3u)/) || b.match(/(\.m3u8)/)) {
                        var E;
                        if (u)(E = console).log.apply(E, (0, p.default)(n(a, "Found : " + y + ", " + r.type, o)));
                        var w = 0 !== s ? m.frames[s] : m.url,
                            T = m.requestHeaders[f];
                        m.push(S.M3U8, {
                            url: o,
                            contentType: y,
                            referer: w,
                            header: T
                        }), N(a)
                    } else {
                        if ("xmlhttprequest" === i && o.match(/[\.\/](m3u|hls)/))
                            if (!b.match(/\.(js|json|html)$/))
                                if (0 === m.que[S.M3U8].length)
                                    if (Number(t(l, "content-length")) < 1048576) {
                                        var _ = m.requestHeaders[f],
                                            x = 0 !== s ? m.frames[s] : m.url;
                                        m.push(S.M3U8_CANDIDATE, {
                                            url: o,
                                            contentType: "application/x-mpegURL",
                                            referer: x,
                                            header: _
                                        }), N(a)
                                    }
                    }
                }
                delete m.requestHeaders[f]
            }
        }), {
            urls: ["<all_urls>"]
        }, ["responseHeaders", "blocking"]), l.tabs.onUpdated.addListener((function (t, r, o) {
            if (_("tabs.onUpdated"), "loading" === r.status) {
                var a = e.pure(o.url),
                    i = g[t];
                if (i) {
                    if (i.isLoader) {
                        var s = (0, v.getLoaderUrl)();
                        if (a.includes(s) || m) {
                            var c;
                            if (u)(c = console).log.apply(c, (0, p.default)(n(t, "tabs.onUpdated", "LoaderTab [ reloading ] , ignore")));
                            var l = g[i.parentTabId];
                            l && (l.stop(), l.reset())
                        } else {
                            var f;
                            if (u)(f = console).log.apply(f, (0, p.default)(n(t, "tabs.onUpdated", a + " [ moved ]")));
                            I.remove(t), I.create(t, {
                                url: a
                            })
                        }
                    } else if (i.url === a);
                    else {
                        var d;
                        if (u)(d = console).log.apply(d, (0, p.default)(n(t, "tabs.onUpdated", a + " [ moved ]")));
                        i.virtualize() || I.remove(t), I.create(t, {
                            url: a
                        })
                    }
                    N(t)
                } else {
                    var h;
                    if (u)(h = console).log.apply(h, (0, p.default)(n(t, "onBeforeRequest", a + " [ new ]")));
                    I.create(t, {
                        url: a
                    })
                }
            }
        })), l.tabs.onRemoved.addListener((function (e) {
            var t, r = g[e];
            u && (t = console).log.apply(t, (0, p.default)(n(e, "tabs.onRemoved", (null == r ? void 0 : r.url) || "none")));
            r && (r.virtualize() || I.remove(e))
        })), l.runtime.onMessage.addListener((function (e, t, r) {
            var o, a, i = e.cmd,
                s = e.params,
                c = e.msgSender,
                f = null === (o = t.tab) || void 0 === o ? void 0 : o.id;
            if ("cmd_open_parser" == i && l.tabs.query({
                    active: !0,
                    lastFocusedWindow: !0
                }, (function (e) {
                    A(e[0], r)
                })), "intercept_ondata" === i) {
                if (g[f]) {
                    var h = s.targetId,
                        v = g[h];
                    v && v.parentTabId === f && l.tabs.sendMessage(h, {
                        cmd: i,
                        params: s
                    }, _("tabs.sendMessage.2"))
                }
                return r()
            }
            u && ("fetch" !== i && (a = console).log.apply(a, (0, p.default)(n(f, "onMessage", JSON.stringify(e).substr(0, 100)))));
            var m = I.find(f, I.CHILD_ID);
            if (!m && c && "cocoParser" == c) return console.log("no tab"), r({
                error: "no related tabs found"
            });
            if ("init" === i) {
                var b = f,
                    y = m.id,
                    S = s.counter || 0,
                    w = (null == d ? void 0 : d.version) || "0.0.0";
                O.counter < S && (O.counter = S, T(O));
                var x = O.counter;
                return m.title ? r({
                    id: b,
                    parentTabId: y,
                    url: m.url,
                    title: m.title,
                    counter: x,
                    version: w
                }) : ("" + m.id).startsWith("virtual_") ? r({
                    id: b,
                    parentTabId: y,
                    url: m.url,
                    title: "video title - none",
                    counter: x
                }) : (l.tabs.get(m.id, (function (e) {
                    return m.title = e.title, r({
                        id: b,
                        parentTabId: y,
                        url: m.url,
                        title: m.title,
                        counter: x,
                        version: w
                    })
                })), !0)
            }
            if ("start_normal" === i) return m.start(E.NORMAL), r();
            if ("fetch" === i) {
                var N = s.url,
                    L = s.method,
                    P = s.headers,
                    D = (s.timeout, s.revokeList);
                return m.revokeObjectURL(D), fetch(N, {
                    method: L || "GET",
                    mode: "cors",
                    credentials: "include",
                    headers: P
                }).then((function (e) {
                    if (e.ok) return e.blob();
                    r({
                        ok: !1,
                        message: "fetch error, may be 403 or 429"
                    })
                })).then((function (e) {
                    var t = URL.createObjectURL(e);
                    m.storedBlob[t] = 1, r({
                        ok: !0,
                        blobUrl: t
                    })
                })).catch((function (e) {
                    r({
                        ok: !1,
                        message: e.messsage
                    })
                })), !0
            }
            if ("intercept_request" === i) {
                if (m && !("" + m.id).startsWith("virtual_")) {
                    m.ignoreDisconnectOnce = !0, setTimeout((function () {
                        delete m.ignoreDisconnectOnce
                    }), 3e3), l.tabs.update(m.id, {
                        active: !0
                    }, _("tabs.update.at.CMD_INTERCEPT_REQUEST"));
                    var M = "localStorage._intercept_mediastream_=" + f + ";location.reload();";
                    return l.tabs.executeScript(m.id, {
                        code: M,
                        allFrames: !0
                    }, _("tabs.executeScript.on.CMD_INTERCEPT_REQUEST")), m.start(E.CAPTURE), O.rcounterr++, T(O), r(!0)
                }
                return r(!1)
            }
            if ("intercept_ok" === i) {
                delete m.ignoreDisconnectOnce;
                l.tabs.executeScript(m.id, {
                    code: "delete localStorage._intercept_mediastream_;",
                    allFrames: !0
                }, _("tabs.executeScript.on.CMD_INTERCEPT_OK"))
            }
            c && "cocoParser" == c && r()
        })), l.commands.onCommand.addListener((function (e) {
            var t = function () {};
            "force-download" === e && ((0, v.isActivePro)() ? l.tabs.query({
                active: !0,
                lastFocusedWindow: !0
            }, (function (e) {
                A(e[0], t)
            })) : l.tabs.create({
                url: v.HOMEPAGE + "/needpro.html",
                active: !0
            }))
        }));
        var N = function (e) {
            if (!(e + "").startsWith("virtual")) {
                var t = g[e],
                    r = !t || t.isLoader ? "loader" : t.mode === E.CAPTURE ? "capturing" : t.que[S.M3U8].length ? "enable" : t.que[S.M3U8_CANDIDATE].length ? "enable_weak" : "off";
                if (r !== t.actionButtonStatus) {
                    var o;
                    if (u)(o = console).log.apply(o, (0, p.default)(n(e, "updatePageActionButton", r)));
                    t.actionButtonStatus = r
                }
            }
        }
    };
    var v = r(3),
        g = t.tabs = {}
}, function (e, t) {
    e.exports = function (e, t) {
        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
    }
}, function (e, t) {
    function r(e, t) {
        for (var r = 0; r < t.length; r++) {
            var n = t[r];
            n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
        }
    }
    e.exports = function (e, t, n) {
        return t && r(e.prototype, t), n && r(e, n), e
    }
}, function (e, t) {
    function r(e) {
        return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
            return typeof e
        } : function (e) {
            return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
        })(e)
    }

    function n(t) {
        return "function" == typeof Symbol && "symbol" === r(Symbol.iterator) ? e.exports = n = function (e) {
            return r(e)
        } : e.exports = n = function (e) {
            return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : r(e)
        }, n(t)
    }
    e.exports = n
}]);